package com.hiv.common.enums;


import com.hiv.mapper.domain.Admin;

import java.util.Objects;

/**
 * @author zhanghong
 */
public enum AccountTypeEnum {
    SUPER_ADMIN(0, "超级管理员"),
    QUALITY_CONTROL_CENTER_ADMIN(1, "质控中心管理员"),
    HOSPITAL_ADMIN(2, "医院管理员"),
    INSPECTION_ADMIN(3, "检验所管理员"),
    HOSPITAL_DOCTOR_ADMIN(3, "医院（医生）");

    private Integer type;
    private String desc;

    AccountTypeEnum(Integer type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public Integer getType() {
        return type;
    }

    public String getDesc() {
        return desc;
    }

    public static boolean isSuperAdmin(Admin admin) {
        if (admin == null || admin.getType() == null) {
            return false;
        }

        return Objects.equals(admin.getType(), SUPER_ADMIN.getType());
    }

    public static boolean isQualityControlCenterAdmin(Admin admin) {
        if (admin == null || admin.getType() == null) {
            return false;
        }

        return Objects.equals(admin.getType(), QUALITY_CONTROL_CENTER_ADMIN.getType());
    }

    public static boolean isHospitalAdmin(Admin admin) {
        if (admin == null || admin.getType() == null) {
            return false;
        }

        return Objects.equals(admin.getType(), HOSPITAL_ADMIN.getType());
    }

    public static boolean isInspectionAdmin(Admin admin) {
        if (admin == null || admin.getType() == null) {
            return false;
        }

        return Objects.equals(admin.getType(), INSPECTION_ADMIN.getType());
    }
}
